We propose to combine technologies for in vivo imaging with automated rat behavioral training systems. This will create a transformative technology platform that will enable the first cellular resolution imaging of neural activity durin complex cognitive tasks. Cellular-resolution functional imaging using genetically encoded calcium sensors enables recording the neural activity of the entire neuronal population within a field of view. Each functionally characterized neuron can be precisely pinpointed in space and recorded over multiple weeks. Achieving such high-resolution imaging during complex cognitive tasks will provide an unprecedentedly comprehensive and detailed view of neural circuit dynamics involved in higher cognition. Rats are the simplest vertebrate species that have been trained to perform behaviors that demand executive function, exemplified by a task requiring the ability to rapidly select and implement goal-directed sensorimotor rules. To characterize the neural circuitry underlying executive function and other higher cognitive abilities, we will develo a system for cellular resolution imaging in awake behaving rats. This will require methods to stabilize brain movements during imaging. In Aim 1 we describe a new method for brain stabilization, inspired by kinematic mounts used to precisely align optical components. The new device will be deployed so that trained rats will voluntarily and repeatedly activate the brain stabilization device over hundreds of trials within each session. The device will be integrated into a semi-automated training facility, which will be used to train rats on complex tasks such as rapid rule-switching. In Aim 2 we will augment the training system with a custom automated two-photon microscope. We will develop implantable optics that minimize brain motion while allowing a clear optical path to the cortical surface. Together with the training system, these devices will be used to record calcium dependent fluorescence transients in neurons from the rat frontal cortex while rats perform cognitive tasks.